#include <2025Linux.h>
int main(int argc, char *argv[])
{
    // ./04_redirect file3 file4
    ARGS_CHECK(argc,3);
    int fd1 = open(argv[1],O_RDWR);
    ERROR_CHECK(fd1,-1,"open");
    int fd2 = open(argv[2],O_RDWR);
    ERROR_CHECK(fd2,-1,"open");
    printf("\n");//避免某些os的bug close(1)之前打印一下
    dup2(fd1,STDOUT_FILENO);
    dup2(fd2,STDERR_FILENO);

    printf("Hello\n");
    fprintf(stderr,"World\n");
    return 0;
}

